streamlit-nightly 1.44.2.dev20250403__py3-none-any.whl → 1.44.2.dev20250406__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/config.py +38 -17
- streamlit/elements/lib/built_in_chart_utils.py +47 -36
- streamlit/elements/lib/event_utils.py +7 -5
- streamlit/elements/markdown.py +1 -1
- streamlit/elements/write.py +3 -1
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/{FileDownload.esm.B3kD8CdX.js → FileDownload.esm.BcMiTwVB.js} +1 -1
- streamlit/static/static/js/{FileHelper.CZMZF2jC.js → FileHelper.DihUx7xB.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.BjztopwY.js → FormClearHelper.BCWMbvg-.js} +1 -1
- streamlit/static/static/js/{Hooks.B2w-p718.js → Hooks.DxswZylT.js} +1 -1
- streamlit/static/static/js/{InputInstructions.CuF13wx9.js → InputInstructions.C3IYQW66.js} +1 -1
- streamlit/static/static/js/{ProgressBar.BbIgSlVa.js → ProgressBar.DsZ44eAG.js} +1 -1
- streamlit/static/static/js/{RenderInPortalIfExists.yENMDBLa.js → RenderInPortalIfExists.CJo1XNP4.js} +1 -1
- streamlit/static/static/js/{Toolbar.DJ7G2mIO.js → Toolbar.zC9RMqvO.js} +1 -1
- streamlit/static/static/js/{base-input.DIlOlDo4.js → base-input.BYAE3JfB.js} +1 -1
- streamlit/static/static/js/{checkbox.BQjuWiaH.js → checkbox.B4yv-nA3.js} +1 -1
- streamlit/static/static/js/{createSuper.DsCxV-v8.js → createSuper.BYXiuZs5.js} +1 -1
- streamlit/static/static/js/{data-grid-overlay-editor.D4K6HcP0.js → data-grid-overlay-editor.BRSP4Q5h.js} +1 -1
- streamlit/static/static/js/{downloader.Lq-fJZlW.js → downloader.GnadH9DP.js} +1 -1
- streamlit/static/static/js/{es6.BE-9QZmp.js → es6.D8RYB6b-.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.CVN6zezL.js → iframeResizer.contentWindow.CjNDfwt8.js} +1 -1
- streamlit/static/static/js/{index.B1gZ98Ih.js → index.B3WIarqf.js} +1 -1
- streamlit/static/static/js/{index.BMWHViZF.js → index.B7qpqtD6.js} +1 -1
- streamlit/static/static/js/{index.B7RGQCfs.js → index.BC5wAIFM.js} +1 -1
- streamlit/static/static/js/{index.0HztFnVa.js → index.BD4E56NB.js} +1 -1
- streamlit/static/static/js/{index.B2XNA40L.js → index.BDlCQX5I.js} +1 -1
- streamlit/static/static/js/{index.5819-zgt.js → index.BPtOLSNm.js} +1 -1
- streamlit/static/static/js/{index.Bs_nrSu4.js → index.BRhhwv-C.js} +1 -1
- streamlit/static/static/js/{index.B-KH-iJ1.js → index.BbAJYVXj.js} +1 -1
- streamlit/static/static/js/{index.Dw1CjpSH.js → index.BqkJyhUo.js} +1 -1
- streamlit/static/static/js/{index.CbDE21BB.js → index.Bxba7-Vj.js} +1 -1
- streamlit/static/static/js/{index.BDovkxCx.js → index.CBxn7sji.js} +1 -1
- streamlit/static/static/js/{index.CWOluRqa.js → index.CDSPljq3.js} +1 -1
- streamlit/static/static/js/{index.CzzEyXiC.js → index.CPBJk1lp.js} +1 -1
- streamlit/static/static/js/{index.BysxR7v7.js → index.CRMmBBDq.js} +1 -1
- streamlit/static/static/js/{index.C6uLzsGN.js → index.C_2tXwz4.js} +1 -1
- streamlit/static/static/js/{index.ChX_XN9v.js → index.CbT7y4TK.js} +1 -1
- streamlit/static/static/js/{index.rPwcP7b8.js → index.CdPagNhq.js} +1 -1
- streamlit/static/static/js/{index.IydYP9PK.js → index.CkZkpK4-.js} +1 -1
- streamlit/static/static/js/{index.DSsFpl6V.js → index.CrEVoSTM.js} +1 -1
- streamlit/static/static/js/{index.CQYXOt0H.js → index.Cxfze3Mk.js} +1 -1
- streamlit/static/static/js/{index.u-RVYMyk.js → index.CzUmKu1R.js} +1 -1
- streamlit/static/static/js/{index.CE-qPTwY.js → index.CzrE9emY.js} +1 -1
- streamlit/static/static/js/{index.CU_SzKbN.js → index.DKCBo3om.js} +1 -1
- streamlit/static/static/js/{index.B0f5Sqj9.js → index.DOpTXgh3.js} +1 -1
- streamlit/static/static/js/{index.TnCoD1oP.js → index.DRrj4vJq.js} +1 -1
- streamlit/static/static/js/{index.CFnDv8Ab.js → index.Dcg-1sHd.js} +1 -1
- streamlit/static/static/js/{index.BB3TfMGO.js → index.Dg7ksnn2.js} +1 -1
- streamlit/static/static/js/{index.BM_qS2Z6.js → index.Dgn3lt9J.js} +1 -1
- streamlit/static/static/js/{index.BwOqVS7B.js → index.DuHTqH_9.js} +1 -1
- streamlit/static/static/js/{index.eNGIEtgK.js → index.DuV4oQbx.js} +5 -5
- streamlit/static/static/js/{index.Cn3q8ZVn.js → index.Dv3BUspB.js} +1 -1
- streamlit/static/static/js/{index.DIxzN4oM.js → index.Kzz4gUPJ.js} +4 -4
- streamlit/static/static/js/{index.WW1pXc2g.js → index.NmHUotTf.js} +1 -1
- streamlit/static/static/js/{index.m_aVBz2b.js → index.PKWaMjh6.js} +1 -1
- streamlit/static/static/js/{index.DmZP-_fu.js → index.UKdSrnn_.js} +1 -1
- streamlit/static/static/js/{index.BYWoEwfP.js → index.W1F0OM9G.js} +1 -1
- streamlit/static/static/js/{index.CDspsVkR.js → index.nEP2fCOO.js} +1 -1
- streamlit/static/static/js/{input.CVw5KI0x.js → input.B970MGo0.js} +1 -1
- streamlit/static/static/js/{memory.CnrS2dOM.js → memory.Bds5EpZ8.js} +1 -1
- streamlit/static/static/js/{mergeWith.DUDC520V.js → mergeWith.zOP131Mw.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.Ccw3Yu2p.js → number-overlay-editor.BxGwsHaY.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.wVJHSwqv.js → possibleConstructorReturn.CngyaSWa.js} +1 -1
- streamlit/static/static/js/{sandbox.CpAztCDM.js → sandbox.COLAm094.js} +1 -1
- streamlit/static/static/js/{textarea.CFjEVTUg.js → textarea.DrttbSkr.js} +1 -1
- streamlit/static/static/js/{timepicker.DMKQZM-V.js → timepicker.D02-j0jX.js} +1 -1
- streamlit/static/static/js/{toConsumableArray.KVlxKIgo.js → toConsumableArray.EMFv73a7.js} +1 -1
- streamlit/static/static/js/{uniqueId.kOCufBPt.js → uniqueId.CdAsXj9D.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.Bs_D3hOD.js → useBasicWidgetState.BDsVFj3k.js} +1 -1
- streamlit/static/static/js/{useOnInputChange.BH-JyYhR.js → useOnInputChange.C8C1na1y.js} +1 -1
- streamlit/static/static/js/{withFullScreenWrapper.vQYihw6n.js → withFullScreenWrapper.BBFCh9IR.js} +1 -1
- streamlit/type_util.py +1 -1
- {streamlit_nightly-1.44.2.dev20250403.dist-info → streamlit_nightly-1.44.2.dev20250406.dist-info}/METADATA +3 -3
- {streamlit_nightly-1.44.2.dev20250403.dist-info → streamlit_nightly-1.44.2.dev20250406.dist-info}/RECORD +78 -78
- {streamlit_nightly-1.44.2.dev20250403.data → streamlit_nightly-1.44.2.dev20250406.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.44.2.dev20250403.dist-info → streamlit_nightly-1.44.2.dev20250406.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.44.2.dev20250403.dist-info → streamlit_nightly-1.44.2.dev20250406.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.44.2.dev20250403.dist-info → streamlit_nightly-1.44.2.dev20250406.dist-info}/top_level.txt +0 -0
streamlit/config.py
CHANGED
@@ -17,12 +17,13 @@
|
|
17
17
|
from __future__ import annotations
|
18
18
|
|
19
19
|
import copy
|
20
|
+
import logging
|
20
21
|
import os
|
21
22
|
import secrets
|
22
23
|
import threading
|
23
24
|
from collections import OrderedDict
|
24
25
|
from enum import Enum
|
25
|
-
from typing import Any, Callable, Literal
|
26
|
+
from typing import Any, Callable, Final, Literal
|
26
27
|
|
27
28
|
from blinker import Signal
|
28
29
|
|
@@ -55,14 +56,16 @@ _config_options: dict[str, ConfigOption] | None = None
|
|
55
56
|
|
56
57
|
|
57
58
|
# Indicates that a config option was defined by the user.
|
58
|
-
_USER_DEFINED = "<user defined>"
|
59
|
+
_USER_DEFINED: Final = "<user defined>"
|
59
60
|
|
60
61
|
# Indicates that a config option was defined either in an environment variable
|
61
62
|
# or via command-line flag.
|
62
|
-
_DEFINED_BY_FLAG = "command-line argument or environment variable"
|
63
|
+
_DEFINED_BY_FLAG: Final = "command-line argument or environment variable"
|
63
64
|
|
64
65
|
# Indicates that a config option was defined in an environment variable
|
65
|
-
_DEFINED_BY_ENV_VAR = "environment variable"
|
66
|
+
_DEFINED_BY_ENV_VAR: Final = "environment variable"
|
67
|
+
|
68
|
+
_LOGGER: Final = logging.getLogger(__name__)
|
66
69
|
|
67
70
|
|
68
71
|
class ShowErrorDetailsConfigOptions(str, Enum):
|
@@ -82,8 +85,9 @@ class ShowErrorDetailsConfigOptions(str, Enum):
|
|
82
85
|
return val in ["false", "False", False]
|
83
86
|
|
84
87
|
# Config options can be set from several places including the command-line and
|
85
|
-
# the user's script. Legacy config options (true/false) will have type string
|
86
|
-
# command-line and bool when set via user script
|
88
|
+
# the user's script. Legacy config options (true/false) will have type string
|
89
|
+
# when set via command-line and bool when set via user script
|
90
|
+
# (e.g. st.set_option("client.showErrorDetails", False)).
|
87
91
|
|
88
92
|
|
89
93
|
class CustomThemeCategories(str, Enum):
|
@@ -162,7 +166,8 @@ def set_user_option(key: str, value: Any) -> None:
|
|
162
166
|
return
|
163
167
|
|
164
168
|
raise StreamlitAPIException(
|
165
|
-
f"{key} cannot be set on the fly. Set as command line option, e.g.
|
169
|
+
f"{key} cannot be set on the fly. Set as command line option, e.g. "
|
170
|
+
"streamlit run script.py --{key}, or in config.toml instead."
|
166
171
|
)
|
167
172
|
|
168
173
|
|
@@ -308,8 +313,11 @@ def _create_theme_options(
|
|
308
313
|
type_: type = str,
|
309
314
|
) -> None:
|
310
315
|
"""
|
311
|
-
Create ConfigOption(s) for a theme-related config option and store it globally in
|
312
|
-
|
316
|
+
Create ConfigOption(s) for a theme-related config option and store it globally in
|
317
|
+
this module.
|
318
|
+
|
319
|
+
The same config option can be supported for multiple categories, e.g. "theme"
|
320
|
+
and "theme.sidebar".
|
313
321
|
"""
|
314
322
|
for cat in categories:
|
315
323
|
section = cat if cat == "theme" else f"theme.{cat.value}"
|
@@ -810,7 +818,9 @@ _create_option(
|
|
810
818
|
description="""
|
811
819
|
Max size, in megabytes, for files uploaded with the file_uploader.
|
812
820
|
""",
|
813
|
-
|
821
|
+
# If this default is changed, please also update the docstring
|
822
|
+
# for `DeltaGenerator.file_uploader`.
|
823
|
+
default_val=200,
|
814
824
|
type_=int,
|
815
825
|
)
|
816
826
|
|
@@ -827,8 +837,9 @@ _create_option(
|
|
827
837
|
_create_option(
|
828
838
|
"server.enableArrowTruncation",
|
829
839
|
description="""
|
830
|
-
Enable automatically truncating all data structures that get serialized
|
831
|
-
to ensure that the size is under
|
840
|
+
Enable automatically truncating all data structures that get serialized
|
841
|
+
into Arrow (e.g. DataFrames) to ensure that the size is under
|
842
|
+
`server.maxMessageSize`.
|
832
843
|
""",
|
833
844
|
visibility="hidden",
|
834
845
|
default_val=False,
|
@@ -1207,8 +1218,8 @@ _create_option(
|
|
1207
1218
|
will take precedence over earlier ones.
|
1208
1219
|
""",
|
1209
1220
|
default_val=[
|
1210
|
-
# NOTE: The order here is important! Project-level secrets should overwrite
|
1211
|
-
# secrets.
|
1221
|
+
# NOTE: The order here is important! Project-level secrets should overwrite
|
1222
|
+
# global secrets.
|
1212
1223
|
file_util.get_streamlit_file_path("secrets.toml"),
|
1213
1224
|
file_util.get_project_streamlit_file_path("secrets.toml"),
|
1214
1225
|
],
|
@@ -1344,9 +1355,18 @@ def _update_config_with_toml(raw_toml: str, where_defined: str) -> None:
|
|
1344
1355
|
Tells the config system where this was set.
|
1345
1356
|
|
1346
1357
|
"""
|
1347
|
-
|
1358
|
+
try:
|
1359
|
+
import toml
|
1348
1360
|
|
1349
|
-
|
1361
|
+
parsed_config_file = toml.loads(raw_toml)
|
1362
|
+
except Exception:
|
1363
|
+
# Catching any parsing exception to prevent this from breaking our
|
1364
|
+
# config change watcher logic.
|
1365
|
+
_LOGGER.exception(
|
1366
|
+
"Error parsing config toml. This is most likely due to a syntax error "
|
1367
|
+
"in the config.toml file. Please fix it and try again.",
|
1368
|
+
)
|
1369
|
+
return
|
1350
1370
|
|
1351
1371
|
def process_section(section_path: str, section_data: dict[str, Any]) -> None:
|
1352
1372
|
"""Recursively process nested sections of the config file.
|
@@ -1560,7 +1580,8 @@ def _check_conflicts() -> None:
|
|
1560
1580
|
if not get_option("server.enableCORS") or get_option("global.developmentMode"):
|
1561
1581
|
LOGGER.warning(
|
1562
1582
|
"""
|
1563
|
-
Warning: the config option 'server.enableCORS=false' is not compatible with
|
1583
|
+
Warning: the config option 'server.enableCORS=false' is not compatible with
|
1584
|
+
'server.enableXsrfProtection=true'.
|
1564
1585
|
As a result, 'server.enableCORS' is being overridden to 'true'.
|
1565
1586
|
|
1566
1587
|
More information:
|
@@ -110,7 +110,8 @@ _SEPARATED_INDEX_COLUMN_NAME: Final = _SEPARATED_INDEX_COLUMN_TITLE + _PROTECTIO
|
|
110
110
|
_MELTED_Y_COLUMN_NAME: Final = _MELTED_Y_COLUMN_TITLE + _PROTECTION_SUFFIX
|
111
111
|
_MELTED_COLOR_COLUMN_NAME: Final = _MELTED_COLOR_COLUMN_TITLE + _PROTECTION_SUFFIX
|
112
112
|
|
113
|
-
# Name we use for a column we know doesn't exist in the data, to address a Vega-Lite
|
113
|
+
# Name we use for a column we know doesn't exist in the data, to address a Vega-Lite
|
114
|
+
# rendering bug
|
114
115
|
# where empty charts need x, y encodings set in order to take up space.
|
115
116
|
_NON_EXISTENT_COLUMN_NAME: Final = "DOES_NOT_EXIST" + _PROTECTION_SUFFIX
|
116
117
|
|
@@ -118,11 +119,12 @@ _NON_EXISTENT_COLUMN_NAME: Final = "DOES_NOT_EXIST" + _PROTECTION_SUFFIX
|
|
118
119
|
def maybe_raise_stack_warning(
|
119
120
|
stack: bool | ChartStackType | None, command: str | None, docs_link: str
|
120
121
|
):
|
121
|
-
# Check that the stack parameter is valid, raise more informative error
|
122
|
+
# Check that the stack parameter is valid, raise more informative error if not
|
122
123
|
if stack not in (None, True, False, "normalize", "center", "layered"):
|
123
124
|
raise StreamlitAPIException(
|
124
|
-
f
|
125
|
-
|
125
|
+
f"Invalid value for stack parameter: {stack}. Stack must be one of True, "
|
126
|
+
'False, "normalize", "center", "layered" or None. See documentation '
|
127
|
+
f"for `{command}` [here]({docs_link}) for more information."
|
126
128
|
)
|
127
129
|
|
128
130
|
|
@@ -140,12 +142,15 @@ def generate_chart(
|
|
140
142
|
# Bar & Area charts only:
|
141
143
|
stack: bool | ChartStackType | None = None,
|
142
144
|
) -> tuple[alt.Chart | alt.LayerChart, AddRowsMetadata]:
|
143
|
-
"""Function to use the chart's type, data columns and indices to figure out the
|
145
|
+
"""Function to use the chart's type, data columns and indices to figure out the
|
146
|
+
chart's spec.
|
147
|
+
"""
|
144
148
|
import altair as alt
|
145
149
|
|
146
150
|
df = dataframe_util.convert_anything_to_pandas_df(data, ensure_copy=True)
|
147
151
|
|
148
|
-
# From now on, use "df" instead of "data". Deleting "data" to guarantee we follow
|
152
|
+
# From now on, use "df" instead of "data". Deleting "data" to guarantee we follow
|
153
|
+
# this.
|
149
154
|
del data
|
150
155
|
|
151
156
|
# Convert arguments received from the user to things Vega-Lite understands.
|
@@ -153,9 +158,11 @@ def generate_chart(
|
|
153
158
|
x_column = _parse_x_column(df, x_from_user)
|
154
159
|
# Get name of columns to use for y.
|
155
160
|
y_column_list = _parse_y_columns(df, y_from_user, x_column)
|
156
|
-
# Get name of column to use for color, or constant value to use. Any/both could
|
161
|
+
# Get name of column to use for color, or constant value to use. Any/both could
|
162
|
+
# be None.
|
157
163
|
color_column, color_value = _parse_generic_column(df, color_from_user)
|
158
|
-
# Get name of column to use for size, or constant value to use. Any/both could
|
164
|
+
# Get name of column to use for size, or constant value to use. Any/both could
|
165
|
+
# be None.
|
159
166
|
size_column, size_value = _parse_generic_column(df, size_from_user)
|
160
167
|
|
161
168
|
# Store some info so we can use it in add_rows.
|
@@ -344,8 +351,9 @@ def _infer_vegalite_type(
|
|
344
351
|
|
345
352
|
from pandas.api.types import infer_dtype
|
346
353
|
|
347
|
-
# STREAMLIT MOD: I'm using infer_dtype directly here, rather than using Altair's
|
348
|
-
# wrapper is only there to support Pandas < 0.20, but Streamlit
|
354
|
+
# STREAMLIT MOD: I'm using infer_dtype directly here, rather than using Altair's
|
355
|
+
# wrapper. Their wrapper is only there to support Pandas < 0.20, but Streamlit
|
356
|
+
# requires Pandas 1.3.
|
349
357
|
typ = infer_dtype(data)
|
350
358
|
|
351
359
|
if typ in [
|
@@ -378,7 +386,7 @@ def _infer_vegalite_type(
|
|
378
386
|
]:
|
379
387
|
return "temporal"
|
380
388
|
else:
|
381
|
-
# STREAMLIT MOD: I commented this out since Streamlit doesn't
|
389
|
+
# STREAMLIT MOD: I commented this out since Streamlit doesn't use warnings.warn.
|
382
390
|
# warnings.warn(
|
383
391
|
# "I don't know how to infer vegalite type from '{}'. "
|
384
392
|
# "Defaulting to nominal.".format(typ),
|
@@ -403,8 +411,8 @@ def _prep_data(
|
|
403
411
|
) -> tuple[pd.DataFrame, str | None, str | None, str | None, str | None]:
|
404
412
|
"""Prepares the data for charting. This is also used in add_rows.
|
405
413
|
|
406
|
-
Returns the prepared dataframe and the new names of the x column (taking the index
|
407
|
-
consideration) and y, color, and size columns.
|
414
|
+
Returns the prepared dataframe and the new names of the x column (taking the index
|
415
|
+
reset into consideration) and y, color, and size columns.
|
408
416
|
"""
|
409
417
|
|
410
418
|
# If y is provided, but x is not, we'll use the index as x.
|
@@ -538,7 +546,8 @@ def _melt_data(
|
|
538
546
|
and len(y_series.unique()) > 100
|
539
547
|
):
|
540
548
|
raise StreamlitAPIException(
|
541
|
-
"The columns used for rendering the chart contain too many values with
|
549
|
+
"The columns used for rendering the chart contain too many values with "
|
550
|
+
"mixed types. Please select the columns manually via the y parameter."
|
542
551
|
)
|
543
552
|
|
544
553
|
# Arrow has problems with object types after melting two different dtypes
|
@@ -608,7 +617,8 @@ def _maybe_convert_color_column_in_place(df: pd.DataFrame, color_column: str | N
|
|
608
617
|
df.loc[:, color_column] = df[color_column].map(to_css_color)
|
609
618
|
else:
|
610
619
|
# Other kinds of colors columns (i.e. pure numbers or nominal strings) shouldn't
|
611
|
-
# be converted since they are treated by Vega-Lite as sequential or categorical
|
620
|
+
# be converted since they are treated by Vega-Lite as sequential or categorical
|
621
|
+
# colors.
|
612
622
|
pass
|
613
623
|
|
614
624
|
|
@@ -704,8 +714,8 @@ def _get_offset_encoding(
|
|
704
714
|
x_offset = alt.XOffset()
|
705
715
|
y_offset = alt.YOffset()
|
706
716
|
|
707
|
-
_color_column: str | alt.
|
708
|
-
color_column if color_column is not None else alt.
|
717
|
+
_color_column: str | alt.typing.Optional[Any] = (
|
718
|
+
color_column if color_column is not None else alt.Undefined
|
709
719
|
)
|
710
720
|
|
711
721
|
if chart_type is ChartType.VERTICAL_BAR:
|
@@ -739,8 +749,8 @@ def _get_axis_config(df: pd.DataFrame, column_name: str | None, grid: bool) -> a
|
|
739
749
|
from pandas.api.types import is_integer_dtype
|
740
750
|
|
741
751
|
if column_name is not None and is_integer_dtype(df[column_name]):
|
742
|
-
# Use a max tick size of 1 for integer columns (prevents zoom into
|
743
|
-
# and deactivate grid lines for x-axis
|
752
|
+
# Use a max tick size of 1 for integer columns (prevents zoom into
|
753
|
+
# float numbers) and deactivate grid lines for x-axis
|
744
754
|
return alt.Axis(tickMinStep=1, grid=grid)
|
745
755
|
|
746
756
|
return alt.Axis(grid=grid)
|
@@ -831,8 +841,8 @@ def _get_x_encoding(
|
|
831
841
|
x_field = _NON_EXISTENT_COLUMN_NAME
|
832
842
|
x_title = ""
|
833
843
|
elif x_column == _SEPARATED_INDEX_COLUMN_NAME:
|
834
|
-
# If the x column name is the crazy anti-collision name we gave it, then need to
|
835
|
-
# up a title so we never show the crazy name to the user.
|
844
|
+
# If the x column name is the crazy anti-collision name we gave it, then need to
|
845
|
+
# set up a title so we never show the crazy name to the user.
|
836
846
|
x_field = x_column
|
837
847
|
# Don't show a label in the x axis (not even a nice label like
|
838
848
|
# SEPARATED_INDEX_COLUMN_TITLE) when we pull the x axis from the index.
|
@@ -879,8 +889,8 @@ def _get_y_encoding(
|
|
879
889
|
y_field = _NON_EXISTENT_COLUMN_NAME
|
880
890
|
y_title = ""
|
881
891
|
elif y_column == _MELTED_Y_COLUMN_NAME:
|
882
|
-
# If the y column name is the crazy anti-collision name we gave it, then need to
|
883
|
-
# up a title so we never show the crazy name to the user.
|
892
|
+
# If the y column name is the crazy anti-collision name we gave it, then need to
|
893
|
+
# set up a title so we never show the crazy name to the user.
|
884
894
|
y_field = y_column
|
885
895
|
# Don't show a label in the y axis (not even a nice label like
|
886
896
|
# MELTED_Y_COLUMN_TITLE) when we pull the x axis from the index.
|
@@ -957,9 +967,7 @@ def _get_color_encoding(
|
|
957
967
|
return alt.ColorValue(to_css_color(cast("Any", color_value[0])))
|
958
968
|
else:
|
959
969
|
return alt.Color(
|
960
|
-
field=color_column
|
961
|
-
if color_column is not None
|
962
|
-
else alt.utils.Undefined,
|
970
|
+
field=color_column if color_column is not None else alt.Undefined,
|
963
971
|
scale=alt.Scale(range=[to_css_color(c) for c in color_values]),
|
964
972
|
legend=_COLOR_LEGEND_SETTINGS,
|
965
973
|
type="nominal",
|
@@ -986,19 +994,19 @@ def _get_color_encoding(
|
|
986
994
|
# full y-axis disappears (maybe a bug in vega-lite)?
|
987
995
|
color_enc["title"] = " "
|
988
996
|
|
989
|
-
# If the 0th element in the color column looks like a color, we'll use the color
|
990
|
-
# values as the colors in our chart.
|
997
|
+
# If the 0th element in the color column looks like a color, we'll use the color
|
998
|
+
# column's values as the colors in our chart.
|
991
999
|
elif len(df[color_column]) and is_color_like(df[color_column].iloc[0]):
|
992
1000
|
color_range = [to_css_color(c) for c in df[color_column].unique()]
|
993
1001
|
color_enc["scale"] = alt.Scale(range=color_range)
|
994
|
-
# Don't show the color legend, because it will just show text with the
|
995
|
-
# like #f00, #00f, etc, which are not user-readable.
|
1002
|
+
# Don't show the color legend, because it will just show text with the
|
1003
|
+
# color values, like #f00, #00f, etc, which are not user-readable.
|
996
1004
|
color_enc["legend"] = None
|
997
1005
|
|
998
1006
|
# Otherwise, let Vega-Lite auto-assign colors.
|
999
|
-
# This codepath is typically reached when the color column contains numbers
|
1000
|
-
# Vega-Lite uses a color gradient to represent them) or strings
|
1001
|
-
# assigns one color for each unique value).
|
1007
|
+
# This codepath is typically reached when the color column contains numbers
|
1008
|
+
# (in which case Vega-Lite uses a color gradient to represent them) or strings
|
1009
|
+
# (in which case Vega-Lite assigns one color for each unique value).
|
1002
1010
|
else:
|
1003
1011
|
pass
|
1004
1012
|
|
@@ -1064,7 +1072,8 @@ def _get_tooltip_encoding(
|
|
1064
1072
|
alt.Tooltip(
|
1065
1073
|
y_column,
|
1066
1074
|
title=_MELTED_Y_COLUMN_TITLE,
|
1067
|
-
|
1075
|
+
# Just picked something random. Doesn't really matter:
|
1076
|
+
type="quantitative",
|
1068
1077
|
)
|
1069
1078
|
)
|
1070
1079
|
else:
|
@@ -1098,7 +1107,8 @@ def _get_x_encoding_type(
|
|
1098
1107
|
if x_column is None:
|
1099
1108
|
return "quantitative" # Anything. If None, Vega-Lite may hide the axis.
|
1100
1109
|
|
1101
|
-
# Vertical bar charts should have a discrete (ordinal) x-axis,
|
1110
|
+
# Vertical bar charts should have a discrete (ordinal) x-axis,
|
1111
|
+
# UNLESS type is date/time
|
1102
1112
|
# https://github.com/streamlit/streamlit/pull/2097#issuecomment-714802475
|
1103
1113
|
if chart_type == ChartType.VERTICAL_BAR and not _is_date_column(df, x_column):
|
1104
1114
|
return "ordinal"
|
@@ -1109,7 +1119,8 @@ def _get_x_encoding_type(
|
|
1109
1119
|
def _get_y_encoding_type(
|
1110
1120
|
df: pd.DataFrame, chart_type: ChartType, y_column: str | None
|
1111
1121
|
) -> VegaLiteType:
|
1112
|
-
# Horizontal bar charts should have a discrete (ordinal) y-axis,
|
1122
|
+
# Horizontal bar charts should have a discrete (ordinal) y-axis,
|
1123
|
+
# UNLESS type is date/time
|
1113
1124
|
if chart_type == ChartType.HORIZONTAL_BAR and not _is_date_column(df, y_column):
|
1114
1125
|
return "ordinal"
|
1115
1126
|
|
@@ -19,10 +19,11 @@ class AttributeDictionary(dict[Any, Any]):
|
|
19
19
|
"""
|
20
20
|
A dictionary subclass that supports attribute-style access.
|
21
21
|
|
22
|
-
This class extends the functionality of a standard dictionary to allow items
|
23
|
-
via attribute-style dot notation in addition to the traditional
|
24
|
-
item is accessed and is itself a dictionary,
|
25
|
-
enabling recursive
|
22
|
+
This class extends the functionality of a standard dictionary to allow items
|
23
|
+
to be accessed via attribute-style dot notation in addition to the traditional
|
24
|
+
key-based access. If a dictionary item is accessed and is itself a dictionary,
|
25
|
+
it is automatically wrapped in another `AttributeDictionary`, enabling recursive
|
26
|
+
attribute-style access.
|
26
27
|
"""
|
27
28
|
|
28
29
|
def __getattr__(self, key):
|
@@ -34,4 +35,5 @@ class AttributeDictionary(dict[Any, Any]):
|
|
34
35
|
f"'{type(self).__name__}' object has no attribute '{key}'"
|
35
36
|
) from err
|
36
37
|
|
37
|
-
__setattr__
|
38
|
+
def __setattr__(self, name: str, value: Any) -> None:
|
39
|
+
self[name] = value
|
streamlit/elements/markdown.py
CHANGED
@@ -22,7 +22,7 @@ from streamlit.string_util import clean_text, validate_icon_or_emoji
|
|
22
22
|
from streamlit.type_util import SupportsStr, is_sympy_expression
|
23
23
|
|
24
24
|
if TYPE_CHECKING:
|
25
|
-
import sympy
|
25
|
+
import sympy # type: ignore
|
26
26
|
|
27
27
|
from streamlit.delta_generator import DeltaGenerator
|
28
28
|
|
streamlit/elements/write.py
CHANGED
@@ -483,7 +483,9 @@ class WriteMixin:
|
|
483
483
|
flush_buffer()
|
484
484
|
self.dg.image(arg)
|
485
485
|
elif type_util.is_keras_model(arg):
|
486
|
-
from tensorflow.python.keras.utils import
|
486
|
+
from tensorflow.python.keras.utils import ( # type: ignore
|
487
|
+
vis_utils,
|
488
|
+
)
|
487
489
|
|
488
490
|
flush_buffer()
|
489
491
|
dot = vis_utils.model_to_dot(arg)
|
streamlit/static/index.html
CHANGED
@@ -51,7 +51,7 @@
|
|
51
51
|
<script>
|
52
52
|
window.prerenderReady = false
|
53
53
|
</script>
|
54
|
-
<script type="module" crossorigin src="./static/js/index.
|
54
|
+
<script type="module" crossorigin src="./static/js/index.Kzz4gUPJ.js"></script>
|
55
55
|
<link rel="stylesheet" crossorigin href="./static/css/index.DKr_zoDj.css">
|
56
56
|
</head>
|
57
57
|
<body>
|
@@ -1 +1 @@
|
|
1
|
-
import{r as e,E as n,_ as a}from"./index.
|
1
|
+
import{r as e,E as n,_ as a}from"./index.Kzz4gUPJ.js";var o=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),e.createElement("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}))});o.displayName="Delete";var i=e.forwardRef(function(t,r){var l={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return e.createElement(n,a({iconAttrs:l,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},t,{ref:r}),e.createElement("rect",{width:24,height:24,fill:"none"}),e.createElement("path",{d:"M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4l-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z"}))});i.displayName="FileDownload";export{o as D,i as F};
|